﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace subtitle_modifier
{
    class ModifiySubtitleCreator
    {
        private string _goodTimeFile;
        private string _goodLangFile;
        public string GoodTimeFile
        {
            get { return _goodTimeFile; }
            set { _goodTimeFile = value; }
        }
        

        public string GoodLangFile
        {
            get { return _goodLangFile; }
            set { _goodLangFile = value; }
        }
        public ModifiySubtitleCreator(string goodTimeFile, string goodLangFile)
        {
            GoodLangFile = goodLangFile;
            GoodTimeFile = goodTimeFile;
        }
        public void run()
        {

            //GoodLangFile Mysub1 = new GoodLangFile(getFileFullPath("Fast.and.Furious. 4CAM.XviD-DEViSE.srt"));
            // SrtFile Mysub2 = new SrtFile(getFileFullPath("Fast and Furious 4 2009.eng.srt"));
            Form1.Instance.addInfo("Starting...");
            GoodLangFile Mysub1 = new GoodLangFile(GoodLangFile);
            SrtFile Mysub2 = new SrtFile(GoodTimeFile);
            //string ans=Translation.TranslateGoogle("North 32' 33', west 116' 49'.", "", "iw");
            Form1.Instance.addInfo(String.Format("Start sync time with external file {0}: ",Mysub2.Info.Name));
            bool status=Mysub1.SyncTimeWithExternalSrtFile(Mysub2);
            if (status == false)
            {
                Form1.Instance.makeButEnable();
                return;
            }
            Form1.Instance.addInfo(String.Format("Finish sync time with external file {0}: ", Mysub2.Info.Name));
            Form1.Instance.addInfo("Start write to new file");
            Mysub1.WriteToNewSrtFile();
            Form1.Instance.addInfo("Finsh write to new file");
            Form1.Instance.makeButEnable();


            //string result = Translation.TranslateGoogle(textBox1.Text, "", "he");
            //textBox2.Text = Translation.WhatLanguage("hello world");

            //SrtFile Mysub = new SrtFile(getFileFullPath("Fast and Furious 1 the 2001.eng.srt"));

            //SrtFile MysubTrans = new SrtFile(@"C:\Users\Karmel\Desktop\Paranormal.Activity.1080p.BluRay.x264-REFiNED\Paranormal.Activity.1080p.Bl.srt_en.Srt");
            //Mysub.TranslateRecords("he", "en");
            //MysubTrans.AddTimeToRecords(new TimeSpan(0, 9, 0));
            //Mysub.WriteToNewSrtFile();
            //textBox1.Text = Mysub.OnWhichRecordDoesTextdisplayed(new TimeSpan(0, 12, 4)).ToString();
            //textBox1.Text += ", " + Mysub.OnWhichRecordDoesTextdisplayed(new TimeSpan(0, 55, 3)).ToString();
            //textBox1.Text += ", " + Mysub.OnWhichRecordDoesTextdisplayed(new TimeSpan(1, 13, 55)).ToString();


            //  GoodLangFile Mysub1 = new GoodLangFile(@getFileFullPath(goodLangFile));
            //SrtFile Mysub2 = new SrtFile(@getFileFullPath(goodTimeFile));

            //GoodLangFile Mysub1 = new GoodLangFile(goodLangFile);
            //SrtFile Mysub2 = new SrtFile(goodTimeFile);
            //TimeSpan DiffPhase1 = Mysub1.GetDiffFromFilePhase1(Mysub2);
            //if (DiffPhase1.Milliseconds > -1)
            //{
            //    Mysub1.AddTimeToRecords(DiffPhase1);
            //    int res = Mysub1.timePointCheker(Mysub2, DiffPhase1, 100);
            //    Mysub1.WriteToNewSrtFile();
            //}
            //else
            //{
            //    MessageBox.Show("Your file Dont much...","Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //}
        }

    }

}
